1. Technical Field
The present invention is directed to an improved data processing system. More specifically, the present invention is directed to a method, system, and computer program product for dynamically determining, prior to transferring data using a chain of buffers in which the data is stored, whether to aggregate buffers by combining selected buffers according to current system capabilities to create a new chain of buffers.
2. Description of Related Art
For high speed I/O adapters, data is typically transferred from the system memory to the adapter using the Direct Memory Access (DMA) transfer method because it usually minimizes CPU utilization and increases the I/O bus bandwidth, generally resulting in overall operating efficiencies. However, the overhead required to set up the DMA makes this method better suited for large contiguous data transfers. If the data is scattered across several small buffers, the efficiency of the DMA decreases due to the necessity of having to physically program the DMA engine for each individual buffer.
To illustrate this point, consider that during normal TCP/IP communications, the protocol stack delivers a packet to the networking adapter driver for transfer out to the network. To avoid a memory copy from the TCP/IP buffer to the driver buffer, the packet is constructed into more than one buffer (i.e. one for the TCP/IP header and at least one for the payload). In some cases, the packet can be further scattered across multiple buffers. As stated above, the DMA setup is CPU consuming, which can vary from system to system, depending on the number of bridges and I/O bus bandwidth. This results in diminished memory and I/O bus performance that can be exacerbated if the data is not aligned to the cache line on each of these buffers.
A solution to this problem is to reduce the number of DMA transactions by aggregating the data from these small buffers into a big contiguous system buffer through copying. However, the additional work to aggregate the data into a single buffer results in the use of extra CPU cycles. This may not be tolerable if the system does not have enough available CPU cycles.
Clearly, the method to aggregate by copying all the small buffers into one big contiguous buffer, and the method that delivers multiple small buffers packets to the adapter for DMA transfers are not always good for all systems. In the former case, the I/O and memory latencies may not be tolerable due to insufficient memory and I/O bandwidth. In the latter case, additional CPU cycles may not be available in some systems.
Therefore, a need exists for a method, system, and computer program product for dynamically selecting, prior to transferring data stored in a chain of separate software buffers, ones of these buffers in the buffer chain to aggregate by combining the selected buffers to form a new buffer chain of buffers according to current system capabilities.